import os

import httpx
from volcenginesdkarkruntime import Ark
proxies = {
    'http': "http://bjproxy2.cicc.group:8080",  # 代理1
    'https': "http://bjproxy2.cicc.group:8080",  # 代理2
}
# 从环境变量中读取您的方舟API Key
client = Ark(
    api_key="075861dc-d8ba-42a1-9683-5ec054173a78",
    base_url="https://ark.cn-beijing.volces.com/api/v3",
    http_client=httpx.Client(proxy="http://bjproxy2.cicc.group:8080")
)
# 创建一个对话请求
completion = client.chat.completions.create(
    # 按需替换 Model ID
    model="doubao-seed-1-6-flash-250828",
    messages=[
        {
            # 指定消息的角色为用户
            "role": "user",
            "content": [
                # 图片信息，希望模型理解的图片
                {"type": "image_url", "image_url": {"url":  "https://necaptcha.nosdn.127.net/03553309be84470499b162bf2545b2d8.jpg"},},
                # 文本消息，希望模型根据图片信息回答的问题
                {"type": "text", "text": "这张图片有一块阴影区域，如果图片的宽度是320，请告诉我阴影区域左边边界位置，只告诉我位置值的数字是多少"},
            ],
        }
    ],
)

print(completion.choices[0].message.content)
